function im_numrow=show_axis(im_numrow,im_numcolumn,row_subimage,column_subimage,residue)


            set(gca, 'XTick', [], 'YTick', []);
            axis tight;
           
           %add axes
           if im_numrow==1
               set(gca,'XtickMode', 'auto');
               set(gca,'XAxisLocation','top');
           end
           
           if im_numrow==row_subimage
               set(gca,'XtickMode', 'auto');
               set(gca,'XAxisLocation','bottom');
           end
           
           if im_numcolumn==1
                set(gca,'YtickMode', 'auto');
                set(gca,'YAxisLocation','left');
           end
           
           if im_numcolumn==column_subimage
               set(gca,'YtickMode', 'auto');
               set(gca,'YAxisLocation','right');
           end
           
           if residue~=0
               
              if (im_numcolumn>=column_subimage-residue+1)&(im_numrow==row_subimage-1)
                  if row_subimage==2
                     set(gca,'XtickMode', 'auto');
                     set(gca,'XAxisLocation','top');
                  else
                     set(gca,'XtickMode', 'auto');
                     set(gca,'XAxisLocation','bottom');
                  end
              end
              if (im_numcolumn==column_subimage-residue)&(im_numrow==row_subimage)
                  if column_subimage-residue>1
                     set(gca,'YtickMode', 'auto');
                     set(gca,'YAxisLocation','right');
                  end
              end
           end
           
           if im_numcolumn>=column_subimage
              im_numrow=im_numrow+1;
           end